Improved hasNativeStartsWith check #4130
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are JS environments where
String.startsWith
exists but doesn't support theposition
parameter (e.g. in the taskpane of Outlook web add-ins). This commit adds a test for proper handling ofposition
to the polyfill check.Note: Turns out this broken polyfill comes with Microsoft's Office JS API in https://ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js 😱
Here's a regular Chrome dev console:
Here's the behavior in the dev console of an Outlook add-in:
This is how it breaks
formatjs
in an Outlook add-in taskpane:A simple message with tags:
The broken
startsWith
implementation breaks the parser.parseTag()
throws INVALID_TAG becausestartsWith
used inbumpIf()
requires a proper handling of the position parameter (this.offset()
in this case).